using micromsg;
using MicroMsg.Common.Event;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Network;
using MicroMsg.Plugin;
using MicroMsg.Plugin.DriftBottle.Scene;
using MicroMsg.Plugin.TXNews;
using MicroMsg.Protocol;
using MicroMsg.Scene.Voice;
using MicroMsg.Storage;
using MicroMsgBackground.Manager;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Threading;
namespace MicroMsg.Scene
{
	public class NetSceneNewSync : NetSceneBaseEx<NewSyncRequest, NewSyncResponse, NewSyncRequest.Builder>
	{
		public delegate bool ProcessCmdItemDelegate(NewSyncRequest request, NewSyncResponse response, List<object> cmdObjectList);
		private const string TAG = "NetSceneNewSync";
		public const int MM_NEWSYNC_PROFILE = 1;
		public const int MM_NEWSYNC_MSG = 2;
		public const int MM_NEWSYNC_WXCONTACT = 4;
		public const int MM_NEWSYNC_PMCONTACT = 8;
		public const int MM_NEWSYNC_QQCONTACT = 16;
		public const int MM_NEWSYNC_BOTTLECONTACT = 64;
		public const int MM_NEWSYNC_DEFAULT_SELECTOR = 7;
		public const int MM_NEWSYNC_ALL_SELECTOR = 31;
		public const int MM_NEWSYNC_ALBUMSYNCKEY = 128;
		public const int MM_NEWSYNC_SNSSYNCKEY = 256;
		private const int MAX_CONTINUE_SYNC_COUNT = 50;
		public const int MAX_RETRY_COUNT = 1;
		public const int TIMER_INTERVAL = 30000;
		private EventWatcher mWatcher;
		private int mContiuneSyncCount;
		private static int mSyncCount;
		private static int mNotifyCount;
		private int mSyncStatus;
		private int mRecvMsgStatus;
		private int mSelector = 7;
		private int mMaxOplogID;
		private DispatcherTimer mTimer;
		public static byte[] mBytesSyncKeyBuf;
		private static bool mIsAppActive;
		public static bool isEnable;
		public static bool mHasNewMsg;
		public NetSceneNewSync()
		{
			this.mWatcher = new EventWatcher(this, null, new EventHandlerDelegate(NetSceneNewSync.HandlerDoScene));
			EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_TIMER_SYNC_REQ, this.mWatcher);
			EventCenter.registerEventWatcher(EventConst.ON_NETSCENE_NOTIFY_SYNC_REQ, this.mWatcher);
			EventCenter.registerEventWatcher(EventConst.ON_APP_ACTIVE, this.mWatcher);
			this.mTimer = new DispatcherTimer();
			this.mTimer.add_Tick(new EventHandler(this.TimerCallBack));
		}
		public static void onLoginHandler()
		{
			MicroMsg.Manager.AccountMgr.mSyncRetryTimes = 0;
			NetSceneNewSync.mSyncCount = 0;
			NetSceneNewSync.mNotifyCount = 0;
			NetSceneNewSync.isEnable = false;
			NetSceneNewSync.mBytesSyncKeyBuf = MicroMsg.Manager.AccountMgr.getCurAccount().bytesSyncKeyBuf;
		}
		public void SetAutoSyncInterval(int interval)
		{
			this.mTimer.set_Interval(new TimeSpan(0, 0, 0, 0, interval));
		}
		public void StartAutoSync()
		{
			Log.smethod_4("NetSceneNewSync", "atuo sync start");
			this.mTimer.Start();
		}
		public void StopAutoSync()
		{
			Log.smethod_4("NetSceneNewSync", "atuo sync stop");
			this.mTimer.Stop();
		}
		public void TimerCallBack(object sender, EventArgs e)
		{
			EventCenter.postEvent(EventConst.ON_NETSCENE_TIMER_SYNC_REQ, null, null);
		}
		public bool doScene(int selector, syncScene scene = syncScene.MM_NEWSYNC_SCENE_OTHER)
		{
			if (!NetSceneNewSync.isEnable)
			{
				Log.smethod_1("NetSceneNewSync", "isEnable is false");
				return false;
			}
			if (!MicroMsg.Manager.AccountMgr.hasValidAccount())
			{
				Log.smethod_1("NetSceneNewSync", "get current account failed.");
				return false;
			}
			if (ServiceCenter.sceneNewInit.isInitializing())
			{
				Log.smethod_4("NetSceneNewSync", "sceneNewInit: isInitializing");
				return true;
			}
			if (ServiceCenter.sceneNewInit.needInit())
			{
				Log.smethod_4("NetSceneNewSync", "doScene: need Init now, selector:" + selector);
				ServiceCenter.sceneNewInit.doScene();
			}
			else
			{
				Log.smethod_4("NetSceneNewSync", string.Concat(new object[]
				{
					"doScene: Sync now, selector:",
					selector,
					" mNotifyCount = ",
					NetSceneNewSync.mNotifyCount
				}));
				this.mSelector |= selector;
				this.mSelector &= -65;
				if (this.mSyncStatus == 1)
				{
					Log.smethod_4("NetSceneNewSync", "is doing sync now,return this request");
					return true;
				}
				this.mSyncStatus = 1;
				NetSceneNewSync.mHasNewMsg = false;
				if (NetSceneNewSync.mNotifyCount > 0)
				{
					NetSceneNewSync.mNotifyCount--;
				}
				NetSceneSyncResult netSceneSyncResult = new NetSceneSyncResult();
				netSceneSyncResult.retCode = RetConst.MM_OK;
				netSceneSyncResult.syncStatus = SyncStatus.syncBegin;
				netSceneSyncResult.syncCount = NetSceneNewSync.mSyncCount;
				netSceneSyncResult.isAppActive = NetSceneNewSync.mIsAppActive;
				if (NetSceneNewSync.mSyncCount == 0 || NetSceneNewSync.mIsAppActive)
				{
					this.setRecvMsgStatus(RecvMsgStatus.isSynNow);
					this.doSceneLocal();
				}
				EventCenter.postEvent(EventConst.ON_NETSCENE_SYNC, netSceneSyncResult, null);
				Log.smethod_5("NetSceneNewSync", "do sync post begin");
				if (NetSceneNewSync.mSyncCount == 0)
				{
					scene = syncScene.MM_NEWSYNC_SCENE_PROCESSSTART;
				}
				this.continueDoScene(this.mSelector, scene);
			}
			return true;
		}
		public bool doSceneLocal()
		{
			Log.smethod_5("NetSceneNewSync", "doScene: doSceneLocal in ");
			if (!MicroMsgBackground.Manager.AccountMgr.loadAccount())
			{
				Log.smethod_5("NetSceneNewSync", "doScene: background account info not exists");
				return true;
			}
			if (MicroMsg.Manager.AccountMgr.getCurAccount().strUsrName != MicroMsgBackground.Manager.AccountMgr.getCurAccount().strUsrName)
			{
				MicroMsgBackground.Manager.AccountMgr.delBackgroundData();
				Log.smethod_1("NetSceneNewSync", "doScene:exception，current username = " + MicroMsg.Manager.AccountMgr.getCurAccount().strUsrName + " background data username = " + MicroMsgBackground.Manager.AccountMgr.getCurAccount().strUsrName);
				return true;
			}
			uint num = 0u;
			List<FlowData> list = MicroMsgBackground.Manager.AccountMgr.loadFlowData();
			if (list == null || list.get_Count() <= 0)
			{
				Log.smethod_5("NetSceneNewSync", "doScene: doSceneLocal flowdatafile not exists");
				return true;
			}
			using (List<FlowData>.Enumerator enumerator = list.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					FlowData current = enumerator.get_Current();
					FlowControl.onNetFlowWithPassedDay(current.len, current.networkType == 1u, (long)current.time);
					num += current.len;
				}
			}
			Log.smethod_5("NetSceneNewSync", string.Concat(new object[]
			{
				"doScene: doSceneLocal background synctimes = ",
				MicroMsgBackground.Manager.AccountMgr.getCurAccount().nSyncTimes,
				" totalsize = ",
				num
			}));
			List<SyncData> list2 = MicroMsgBackground.Manager.AccountMgr.loadSyncData();
			if (list2 != null && list2.get_Count() > 0)
			{
				Log.smethod_5("NetSceneNewSync", "doScene:process Data ,count = " + list2.get_Count());
				using (List<SyncData>.Enumerator enumerator2 = list2.GetEnumerator())
				{
					while (enumerator2.MoveNext())
					{
						SyncData current2 = enumerator2.get_Current();
						this.processLocalSyncData(current2);
					}
				}
				Log.smethod_5("NetSceneNewSync", "doScene: doSceneLocal out ");
				return true;
			}
			Log.smethod_5("NetSceneNewSync", "doScene: doSceneLocal syncdatafile not exists");
			return true;
		}
		public bool processLocalSyncData(SyncData syncData)
		{
			NewSyncRequest newSyncRequest = NewSyncRequest.ParseFrom(syncData.requestBuf);
			NewSyncResponse newSyncResponse = NewSyncResponse.ParseFrom(syncData.responseBuf);
			if (newSyncRequest == null || newSyncResponse == null)
			{
				Log.smethod_1("NetSceneNewSync", "doScene: failed! invalid request or response");
				return false;
			}
			int ret = newSyncResponse.Ret;
			if (ret != 0)
			{
				Log.smethod_1("NetSceneNewSync", "doScene: failed! processLocalSyncData，response.Ret" + ret);
				return false;
			}
			List<object> cmdObjectList = NetSceneNewSync.getCmdObjectList(newSyncResponse.CmdList.ListList);
			NetSceneNewSync.RespHandler(cmdObjectList);
			if (!this.saveInfo(newSyncRequest, newSyncResponse))
			{
				Log.smethod_1("NetSceneNewSync", "doScene: SaveUserInfo failed");
			}
			return true;
		}
		private bool continueDoScene(int selector, syncScene scene)
		{
			base.beginBuilder();
			this.mBuilder.Selector = (uint)selector;
			this.mBuilder.Oplog = OpLogMgr.getCmdItemList();
			this.mMaxOplogID = OpLogMgr.getMaxOplogID();
			Log.smethod_4("NetSceneNewSync", string.Concat(new object[]
			{
				"oplog count = ",
				OpLogMgr.getCmdItemList().Count,
				" mMaxOplogID = ",
				this.mMaxOplogID,
				" selector = ",
				selector,
				" scene = ",
				scene
			}));
			this.mBuilder.KeyBuf = Util.toSKBuffer(NetSceneNewSync.mBytesSyncKeyBuf);
			this.mBuilder.Scene = (uint)scene;
			this.mSessionPack.mCmdID = 26;
			base.endBuilder();
			if (this.mContiuneSyncCount < 50)
			{
				this.mContiuneSyncCount++;
			}
			else
			{
				Log.smethod_5("NetSceneNewSync", "mSyncCount exceed the maximum");
			}
			return true;
		}
		protected override void onSuccess(NewSyncRequest request, NewSyncResponse response)
		{
			MicroMsg.Manager.AccountMgr.mSyncRetryTimes = 0;
			int ret = response.Ret;
			if (ret != 0)
			{
				Log.smethod_1("NetSceneNewSync", "doScene: Sync failed!" + ret);
				this.mSyncStatus = 2;
				NetSceneSyncResult netSceneSyncResult = new NetSceneSyncResult();
				netSceneSyncResult.retCode = (RetConst)response.Ret;
				netSceneSyncResult.syncStatus = SyncStatus.syncErr;
				netSceneSyncResult.syncCount = NetSceneNewSync.mSyncCount;
				netSceneSyncResult.isAppActive = NetSceneNewSync.mIsAppActive;
				if (NetSceneNewSync.mSyncCount == 0 || NetSceneNewSync.mIsAppActive)
				{
					this.unsetRecvMsgStatus(RecvMsgStatus.isSynNow);
				}
				EventCenter.postEvent(EventConst.ON_NETSCENE_SYNC, netSceneSyncResult, null);
				NetSceneNewSync.mIsAppActive = false;
				return;
			}
			Log.smethod_4("NetSceneNewSync", string.Concat(new object[]
			{
				"doScene: Sync success, continueFlag = ",
				response.ContinueFlag,
				" response.CmdList.Count = ",
				response.CmdList.Count,
				"status =",
				response.Status
			}));
			this.ParseWeixinStatus(response.Status);
			ServiceCenter.asyncExec(delegate
			{
				List<object> cmdObjectList = NetSceneNewSync.getCmdObjectList(response.CmdList.ListList);
				object[] array = new object[]
				{
					request,
					response,
					cmdObjectList
				};
				Deployment.get_Current().get_Dispatcher().BeginInvoke(new NetSceneNewSync.ProcessCmdItemDelegate(this.ProcessCmdItem), array);
			});
		}
		private void ParseWeixinStatus(uint status)
		{
			NetSceneWeixinStatus netSceneWeixinStatus = new NetSceneWeixinStatus();
			if ((status & 1u) > 0u)
			{
				netSceneWeixinStatus.isWebWeiXinLogin = true;
			}
			if ((status & 2u) > 0u)
			{
				netSceneWeixinStatus.isShakeTranImgBind = true;
			}
			if ((status & 4u) > 0u)
			{
				netSceneWeixinStatus.isShakeTranImgActive = true;
			}
			EventCenter.postEvent(EventConst.ON_NETSCENE_SYNC_WEIN_STATUS, netSceneWeixinStatus, null);
		}
		private bool ProcessCmdItem(NewSyncRequest request, NewSyncResponse response, List<object> cmdObjectList)
		{
			OpLogMgr.clear(this.mMaxOplogID);
			NetSceneNewSync.RespHandler(cmdObjectList);
			if (!this.saveInfo(request, response))
			{
				Log.smethod_1("NetSceneNewSync", "SaveUserInfo failed");
			}
			if (this.canContinue(response))
			{
				Log.smethod_4("NetSceneNewSync", "doScene: Sync NewSyncContinue");
				this.continueDoScene(this.mSelector, syncScene.MM_NEWSYNC_SCENE_CONTINUEFLAG);
				return true;
			}
			Log.smethod_4("NetSceneNewSync", string.Concat(new object[]
			{
				"doScene: Sync finished mSyncCount = ",
				NetSceneNewSync.mSyncCount,
				" mNotifyCount = ",
				NetSceneNewSync.mNotifyCount
			}));
			this.mSyncStatus = 0;
			NetSceneSyncResult netSceneSyncResult = new NetSceneSyncResult();
			netSceneSyncResult.retCode = (RetConst)response.Ret;
			netSceneSyncResult.syncStatus = SyncStatus.syncEnd;
			netSceneSyncResult.syncCount = NetSceneNewSync.mSyncCount;
			netSceneSyncResult.isAppActive = NetSceneNewSync.mIsAppActive;
			netSceneSyncResult.hasNewMsg = NetSceneNewSync.mHasNewMsg;
			if (NetSceneNewSync.mSyncCount == 0 || NetSceneNewSync.mIsAppActive)
			{
				this.unsetRecvMsgStatus(RecvMsgStatus.isSynNow);
			}
			EventCenter.postEvent(EventConst.ON_NETSCENE_SYNC, netSceneSyncResult, null);
			NetSceneNewSync.mIsAppActive = false;
			this.resetFlag();
			NetSceneNewSync.mSyncCount++;
			if (NetSceneNewSync.mNotifyCount > 0)
			{
				NetSceneNewSync.mNotifyCount = 1;
				this.doScene(this.mSelector, syncScene.MM_NEWSYNC_SCENE_NOTIFY);
			}
			else
			{
				NetSceneNewSync.mNotifyCount = 0;
			}
			return true;
		}
		private void resetFlag()
		{
			this.mContiuneSyncCount = 0;
			this.mSelector = 7;
			this.mMaxOplogID = 0;
		}
		protected override void onFailed(NewSyncRequest request, NewSyncResponse response)
		{
			PackResult lastError = base.getLastError();
			this.resetFlag();
			Log.smethod_1("NetSceneNewSync", string.Concat(new object[]
			{
				"doScene: Sync failed! packResult =",
				lastError,
				" mSyncRetryTimes = ",
				MicroMsg.Manager.AccountMgr.mSyncRetryTimes
			}));
			this.mSyncStatus = 2;
			NetSceneSyncResult netSceneSyncResult = new NetSceneSyncResult();
			netSceneSyncResult.retCode = RetConst.MM_ERR_CLIENT;
			netSceneSyncResult.syncStatus = SyncStatus.syncErr;
			netSceneSyncResult.syncCount = NetSceneNewSync.mSyncCount;
			netSceneSyncResult.isAppActive = NetSceneNewSync.mIsAppActive;
			if (NetSceneNewSync.mSyncCount == 0 || NetSceneNewSync.mIsAppActive)
			{
				this.unsetRecvMsgStatus(RecvMsgStatus.isSynNow);
			}
			EventCenter.postEvent(EventConst.ON_NETSCENE_SYNC, netSceneSyncResult, null);
			NetSceneNewSync.mIsAppActive = false;
			if (lastError == PackResult.PACK_TIMEOUT && MicroMsg.Manager.AccountMgr.mSyncRetryTimes < 1)
			{
				Log.smethod_1("NetSceneNewSync", "doScene: Sync timeout! retry doscene mSyncRetryTimes = " + MicroMsg.Manager.AccountMgr.mSyncRetryTimes);
				this.doScene(this.mSelector, syncScene.MM_NEWSYNC_SCENE_OTHER);
				MicroMsg.Manager.AccountMgr.mSyncRetryTimes++;
				return;
			}
			MicroMsg.Manager.AccountMgr.mSyncRetryTimes = 0;
		}
		private bool canContinue(NewSyncResponse resp)
		{
			return (((ulong)resp.ContinueFlag & (ulong)((long)this.mSelector)) != 0uL || OpLogMgr.count() > 0) && this.mContiuneSyncCount < 50;
		}
		private bool saveInfo(NewSyncRequest request, NewSyncResponse response)
		{
			if (request != null && response != null)
			{
				NetSceneNewSync.mBytesSyncKeyBuf = NetSceneNewInit.mergeKeyBuf(request.KeyBuf.Buffer.ToByteArray(), response.KeyBuf.Buffer.ToByteArray());
				MicroMsg.Manager.SyncInfo info = new MicroMsg.Manager.SyncInfo(NetSceneNewSync.mBytesSyncKeyBuf);
				MicroMsg.Manager.AccountMgr.saveSyncInfoAsync(info);
				return true;
			}
			Log.smethod_1("NetSceneNewSync", "invalid NewSyncReq or NewSyncResp");
			return false;
		}
		private CmdList getCmdItemList(List<object> opList)
		{
			CmdList.Builder builder = new CmdList.Builder();
			using (List<object>.Enumerator enumerator = opList.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					object current = enumerator.get_Current();
					CmdItem cmdItem = CmdItemHelper.toCmdItem(current);
					if (cmdItem != null)
					{
						builder.ListList.Add(cmdItem);
					}
				}
			}
			return builder.SetCount((uint)builder.ListList.get_Count()).Build();
		}
		public static List<object> getCmdObjectList(IList<CmdItem> cmdList)
		{
			List<object> list = new List<object>();
			using (IEnumerator<CmdItem> enumerator = cmdList.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					CmdItem current = enumerator.get_Current();
					object obj = CmdItemHelper.toCmdObject(current);
					if (obj != null)
					{
						list.Add(obj);
					}
				}
			}
			return list;
		}
		private static void HandlerDoScene(EventWatcher watcher, BaseEventArgs evtArgs)
		{
			if (evtArgs == null)
			{
				return;
			}
			int num = 7;
			Log.smethod_4("NetSceneNewSync", "onHander NetSceneNewSync mEventID = " + evtArgs.mEventID);
			syncScene scene;
			if (evtArgs.mEventID == EventConst.ON_APP_ACTIVE)
			{
				NetSceneNewSync.mIsAppActive = true;
				scene = syncScene.MM_NEWSYNC_SCENE_BG2FG;
			}
			else
			{
				if (evtArgs.mEventID == EventConst.ON_NETSCENE_NOTIFY_SYNC_REQ)
				{
					if (evtArgs.mObject != null)
					{
						num = (int)evtArgs.mObject;
					}
					num &= -257;
					num &= 31;
					if (num == 0)
					{
						return;
					}
					NetSceneNewSync.mNotifyCount++;
					scene = syncScene.MM_NEWSYNC_SCENE_NOTIFY;
				}
				else
				{
					scene = syncScene.MM_NEWSYNC_SCENE_TIMER;
				}
			}
			ServiceCenter.sceneNewSync.doScene(num, scene);
		}
		public static void RespHandler(List<object> cmdObjectList)
		{
			Log.smethod_4("NetSceneNewSync", "parsed cmdlist count =" + cmdObjectList.get_Count());
			for (int i = 0; i < cmdObjectList.get_Count(); i++)
			{
				object obj = cmdObjectList.get_Item(i);
				if (CmdItemHelper.mapCmdId.ContainsKey(obj.GetType()))
				{
					SyncCmdID syncCmdID = CmdItemHelper.mapCmdId.get_Item(obj.GetType());
					SyncCmdID syncCmdID2 = syncCmdID;
					switch (syncCmdID2)
					{
					case SyncCmdID.CmdIdModUserInfo:
						NetSceneNewSync.processModUserInfo(obj as ModUserInfo);
						goto IL_1D6;
					case SyncCmdID.CmdIdModContact:
					case SyncCmdID.CmdIdModContactDomainEmail:
						i += NetSceneNewSync.processModContactCmdList(NetSceneNewSync.groupCmdList(cmdObjectList, i));
						goto IL_1D6;
					case (SyncCmdID)3:
					case SyncCmdID.CmdIdModMsgStatus:
					case SyncCmdID.CmdIdReport:
					case SyncCmdID.CmdIdOpenQQMicroBlog:
					case SyncCmdID.CmdIdCloseMicroBlog:
					case SyncCmdID.CmdIdModNotifyStatus:
					case SyncCmdID.CmdIdQuitChatRoom:
					case SyncCmdID.CmdIdModChatRoomNotify:
					case SyncCmdID.CmdIdPossibleFriend:
					case SyncCmdID.CmdIdPsmStat:
					case SyncCmdID.CmdIdModChatRoomTopic:
					case (SyncCmdID)28:
					case (SyncCmdID)29:
					case SyncCmdID.MM_SYNCCMD_UPDATESTAT:
					case SyncCmdID.MM_SYNCCMD_MODDISTURBSETTING:
					case SyncCmdID.MM_SYNCCMD_DELETEBOTTLE:
					case SyncCmdID.MM_SYNCCMD_DELBOTTLECONTACT:
						break;
					case SyncCmdID.CmdIdDelContact:
						i += NetSceneNewSync.processDelContactCmdList(NetSceneNewSync.groupCmdList(cmdObjectList, i));
						goto IL_1D6;
					case SyncCmdID.CmdIdAddMsg:
						i += NetSceneNewSync.processAddMsgList(NetSceneNewSync.groupCmdList(cmdObjectList, i));
						goto IL_1D6;
					case SyncCmdID.CmdIdDelChatContact:
						NetSceneNewSync.processDelChatContact(obj as DelChatContact);
						goto IL_1D6;
					case SyncCmdID.CmdIdDelContactMsg:
					case SyncCmdID.CmdIdDelMsg:
					case SyncCmdID.CmdIdModUserDomainEmail:
					case SyncCmdID.CmdIdDelUserDomainEmail:
					case SyncCmdID.MM_SYNCCMD_MODBOTTLECONTACT:
						goto IL_1D6;
					case SyncCmdID.CmdIdModMicroBlog:
						NetSceneNewSync.processModMicroBlog(obj as ModMicroBlogInfo);
						goto IL_1D6;
					case SyncCmdID.CmdIdModChatRoomMember:
						i += NetSceneNewSync.processModChatRoomMemberList(NetSceneNewSync.groupCmdList(cmdObjectList, i));
						goto IL_1D6;
					case SyncCmdID.CmdIdInviteFriendOpen:
						NetSceneNewSync.processInviteFriendOpen(obj as InviteFriendOpen);
						goto IL_1D6;
					case SyncCmdID.CmdIdFunctionSwitch:
						NetSceneNewSync.processFunctionSwitch(obj as FunctionSwitch);
						goto IL_1D6;
					case SyncCmdID.CmdIdModQContact:
						NetSceneNewSync.processModQContact(obj as QContact);
						goto IL_1D6;
					case SyncCmdID.CmdIdModTContact:
						NetSceneNewSync.processModTContact(obj as TContact);
						goto IL_1D6;
					case SyncCmdID.MM_SYNCCMD_MODUSERIMG:
						NetSceneNewSync.processModUserImg(obj as ModUserImg);
						goto IL_1D6;
					default:
						if (syncCmdID2 == SyncCmdID.MM_SYNCCMD_USERINFOEXT)
						{
							NetSceneNewSync.processModUserInfoExt(obj as UserInfoExt);
							goto IL_1D6;
						}
						break;
					}
					Log.smethod_5("NetSceneNewSync", "doCmd: no processing method, cmd id=" + syncCmdID);
				}
				IL_1D6:;
			}
		}
		private static List<object> groupCmdList(List<object> cmdList, int int_0)
		{
			Type type = cmdList.get_Item(int_0).GetType();
			List<object> list = new List<object>();
			list.Clear();
			do
			{
				list.Add(cmdList.get_Item(int_0));
				int_0++;
				if (int_0 >= cmdList.get_Count())
				{
					break;
				}
			}
			while (cmdList.get_Item(int_0).GetType() == type);
			return list;
		}
		public static int processModContactCmdList(List<object> cmdList)
		{
			try
			{
				List<Contact> list = new List<Contact>();
				using (List<object>.Enumerator enumerator = cmdList.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						object current = enumerator.get_Current();
						Contact contact = NetSceneNewSync.processModContact(current as ModContact);
						if (contact == null)
						{
							Log.smethod_1("NetSceneNewSync", "invalid cmd, convert cmd to ModContact failed");
						}
						else
						{
							list.Add(contact);
						}
					}
				}
				StorageMgr.contact.mergeList(list);
				List<Contact> list2 = new List<Contact>();
				List<ChatRoom> list3 = new List<ChatRoom>();
				using (List<object>.Enumerator enumerator2 = cmdList.GetEnumerator())
				{
					while (enumerator2.MoveNext())
					{
						object current2 = enumerator2.get_Current();
						NetSceneNewSync.processContactExt(current2 as ModContact, list2, list3);
					}
				}
				StorageMgr.contact.mergeList(list2);
				StorageMgr.chatRoom.updateList(list3);
			}
			catch (Exception ex)
			{
				Log.smethod_5("NetSceneNewSync", " processModContact failed" + ex.get_Message());
			}
			Log.smethod_5("NetSceneNewSync", "StorageMgr.contact.updateList(contactList) finished");
			return cmdList.get_Count() - 1;
		}
		private static int processDelContactCmdList(List<object> cmdList)
		{
			List<string> list = new List<string>();
			using (List<object>.Enumerator enumerator = cmdList.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					object current = enumerator.get_Current();
					try
					{
						DelContact delContact = current as DelContact;
						if (delContact == null)
						{
							Log.smethod_5("NetSceneNewSync", "cmd as DelContact failed");
						}
						else
						{
							list.Add(delContact.UserName.String);
						}
					}
					catch (Exception ex)
					{
						Log.smethod_5("NetSceneNewSync", "process next, processDelContact failed" + ex.get_Message());
					}
				}
			}
			StorageMgr.contact.method_5(list);
			return cmdList.get_Count() - 1;
		}
		private static Contact processModContact(ModContact cmdMC)
		{
			if (cmdMC == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModContact ,invalid object");
				return null;
			}
			Contact contact = new Contact();
			contact.strUsrName = cmdMC.UserName.String;
			contact.nFlags = (cmdMC.BitMask & cmdMC.BitVal);
			contact.strNickName = cmdMC.NickName.String;
			contact.strPYInitial = (string.IsNullOrEmpty(cmdMC.PYInitial.String) ? SortStringsByAlpha.ConvertStringToPinyinInitial(contact.strNickName) : cmdMC.PYInitial.String);
			contact.strQuanPin = (string.IsNullOrEmpty(cmdMC.QuanPin.String) ? GetPinYin.ConvertStrToQuanPin(contact.strNickName) : cmdMC.QuanPin.String);
			contact.nSex = cmdMC.Sex;
			contact.strRemark = cmdMC.Remark.String;
			if (!string.IsNullOrEmpty(contact.strRemark))
			{
				contact.strRemarkPYInitial = (string.IsNullOrEmpty(cmdMC.RemarkPYInitial.String) ? SortStringsByAlpha.ConvertStringToPinyinInitial(contact.strRemark) : cmdMC.RemarkPYInitial.String);
				contact.strRemarkQuanPin = (string.IsNullOrEmpty(cmdMC.RemarkQuanPin.String) ? GetPinYin.ConvertStrToQuanPin(contact.strRemark) : cmdMC.RemarkQuanPin.String);
			}
			else
			{
				contact.strRemarkPYInitial = "";
				contact.strRemarkQuanPin = "";
			}
			contact.nContactType = cmdMC.ContactType;
			contact.strDomainList = cmdMC.DomainList.String;
			contact.nChatRoomNotify = cmdMC.ChatRoomNotify;
			if (cmdMC.ImgFlag != 1u)
			{
				if (cmdMC.ImgFlag == 2u)
				{
					contact.nImgFlag = cmdMC.ImgFlag;
					HeadImageMgr.update(contact.strUsrName);
				}
				else
				{
					contact.nImgFlag = cmdMC.ImgFlag;
				}
			}
			contact.nAddContactScene = cmdMC.AddContactScene;
			contact.strSignature = cmdMC.Signature;
			contact.strProvince = cmdMC.Province;
			contact.strCity = cmdMC.City;
			contact.nPersonalCard = cmdMC.PersonalCard;
			contact.nHasWeiXinHdHeadImg = cmdMC.HasWeiXinHdHeadImg;
			contact.nVerifyFlag = cmdMC.VerifyFlag;
			contact.strVerifyInfo = cmdMC.VerifyInfo;
			contact.strAlias = cmdMC.Alias;
			contact.nSource = new uint?(cmdMC.Source);
			contact.nSnsFlag = cmdMC.SnsUserInfo.SnsFlag;
			contact.strSnsBGImgID = cmdMC.SnsUserInfo.SnsBGImgID;
			contact.nSnsBGObjectID = cmdMC.SnsUserInfo.SnsBGObjectID;
			contact.strChatRoomOwner = cmdMC.ChatRoomOwner;
			contact.strWeibo = cmdMC.Weibo;
			contact.nWeiboFlag = cmdMC.WeiboFlag;
			contact.strWeiboNickname = cmdMC.WeiboNickname;
			contact.strMyBrandList = cmdMC.MyBrandList;
			contact.nBrandFlag = cmdMC.CustomizedInfo.BrandFlag;
			contact.strBrandExternalInfo = cmdMC.CustomizedInfo.ExternalInfo;
			contact.strBrandInfo = cmdMC.CustomizedInfo.BrandInfo;
			contact.strBrandIconURL = cmdMC.CustomizedInfo.BrandIconURL;
			contact.nUpdateDay = Util.getNowDays();
			return contact;
		}
		private static void processContactExt(ModContact cmdMC, List<Contact> roomMemberContactList, List<ChatRoom> chatRoomList)
		{
			if (cmdMC == null)
			{
				Log.smethod_1("NetSceneNewSync", "invalid cmdMC");
				return;
			}
			if (cmdMC.RoomInfoListList.get_Count() > 0)
			{
				IList<RoomInfo> roomInfoListList = cmdMC.RoomInfoListList;
				List<string> list = new List<string>();
				for (int i = 0; i < roomInfoListList.get_Count(); i++)
				{
					RoomInfo roomInfo = roomInfoListList.get_Item(i);
					Contact contact = StorageMgr.contact.method_0(roomInfo.UserName.String);
					if (contact == null)
					{
						contact = new Contact();
						contact.strUsrName = roomInfo.UserName.String;
					}
					contact.strNickName = roomInfo.NickName.String;
					ContactMgr.setChatroomContact(contact, true);
					roomMemberContactList.Add(contact);
					list.Add(roomInfo.UserName.String);
				}
				chatRoomList.Add(new ChatRoom
				{
					strChatRoomName = cmdMC.UserName.String,
					strUserNameList = ChatRoomMgr.userNameListToString(list),
					nTime = (uint)Util.getNowSeconds()
				});
			}
		}
		private static int processAddMsgList(List<object> cmdList)
		{
			List<ChatMsg> list = new List<ChatMsg>();
			try
			{
				using (List<object>.Enumerator enumerator = cmdList.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						object current = enumerator.get_Current();
						ChatMsg chatMsg = NetSceneNewSync.processAddMsg(current as AddMsg);
						if (chatMsg == null)
						{
							Log.smethod_1("NetSceneNewSync", "invalid cmd, convert cmd to AddMsg failed");
						}
						else
						{
							list.Add(chatMsg);
						}
					}
				}
				ChatMsgMgr.updateListByMsgSvrID(list);
				using (List<object>.Enumerator enumerator2 = cmdList.GetEnumerator())
				{
					while (enumerator2.MoveNext())
					{
						object current2 = enumerator2.get_Current();
						NetSceneNewSync.processAddMsgExt(current2 as AddMsg);
					}
				}
			}
			catch (Exception ex)
			{
				Log.smethod_5("NetSceneNewSync", "processAddMsgList failed" + ex.get_Message());
			}
			return cmdList.get_Count() - 1;
		}
		private static ChatMsg processAddMsg(AddMsg cmdAM)
		{
			if (cmdAM == null)
			{
				Log.smethod_1("NetSceneNewSync", "processAddMsg,invalid object");
				return null;
			}
			if (cmdAM.FromUserName.String.get_Length() <= 0 || cmdAM.ToUserName.String.get_Length() <= 0)
			{
				Log.smethod_1("NetSceneNewSync", "neither from-user nor to-user can be empty");
				return null;
			}
			if ((cmdAM.FromUserName.Equals(ConstantValue.TAG_NEWS) || cmdAM.ToUserName.Equals(ConstantValue.TAG_NEWS)) && MicroMsg.Plugin.TXNews.TXNews.getInstance() != null && !MicroMsg.Plugin.TXNews.TXNews.getInstance().mEnabled)
			{
				Log.smethod_1("NetSceneNewSync", "TXNews forbiddened, the message will be ignored");
				return null;
			}
			if (cmdAM.MsgType == 9998)
			{
				Log.smethod_5("NetSceneNewSync", "postEvent = EventConst.SYS_MSG_STAT_REPORT");
				EventCenter.postEvent(EventConst.SYS_MSG_STAT_REPORT, cmdAM.FromUserName.String, null);
				return null;
			}
			if (cmdAM.MsgType == 51)
			{
				Log.smethod_5("NetSceneNewSync", "postEvent = EventConst.SYS_MSG_WEB_WX_STATUSNOTIFY");
				EventCenter.postEvent(EventConst.SYS_MSG_WEB_WX_STATUSNOTIFY, cmdAM.Content.String, null);
				return null;
			}
			ChatMsg chatMsg = new ChatMsg();
			chatMsg.nMsgSvrID = cmdAM.MsgId;
			string strUsrName = MicroMsg.Manager.AccountMgr.getCurAccount().strUsrName;
			chatMsg.nCreateTime = (long)((ulong)cmdAM.CreateTime);
			if (cmdAM.Content.String != null)
			{
				chatMsg.strMsg = cmdAM.Content.String;
			}
			chatMsg.nMsgType = cmdAM.MsgType;
			if (strUsrName.Equals(cmdAM.FromUserName.String))
			{
				chatMsg.nIsSender = 1;
				chatMsg.strTalker = cmdAM.ToUserName.String;
			}
			else
			{
				chatMsg.nIsSender = 0;
				chatMsg.strTalker = cmdAM.FromUserName.String;
			}
			chatMsg.nStatus = 2;
			if (cmdAM.MsgType == 34)
			{
				chatMsg.nStatus = 0;
			}
			NetSceneNewSync.mHasNewMsg = true;
			DriftBottleServiceCenter.proccessBottleMsg(chatMsg);
			if (chatMsg.nMsgType == 47)
			{
				EmojiDownloadInfo emojiDownloadInfo = EmojiImageService.getEmojiDownloadInfo(chatMsg.strMsg);
				if (!string.IsNullOrEmpty(emojiDownloadInfo.strMd5))
				{
					CustomSmiley customSmileyByMd = CustomSmileyManager.GetCustomSmileyByMd5(emojiDownloadInfo.strMd5);
					if (customSmileyByMd != null)
					{
						chatMsg.strThumbnail = customSmileyByMd.ThumbSrc;
						chatMsg.strPath = customSmileyByMd.ImageSrc;
					}
					else
					{
						new NetSceneEmojiDownload().doScene(emojiDownloadInfo, chatMsg);
					}
				}
			}
			return chatMsg;
		}
		private static void processAddMsgExt(AddMsg cmdAM)
		{
			if (cmdAM == null)
			{
				Log.smethod_1("NetSceneNewSync", "invalid cmdobject");
				return;
			}
			if (cmdAM.MsgType == 34)
			{
				Log.smethod_4("NetSceneNewSync", "receive a voice msg");
				DownloadVoiceService.downloadVoiceInfo(cmdAM);
			}
			if (cmdAM.MsgType == 3 && cmdAM.ImgStatus == 2u)
			{
				Log.smethod_4("NetSceneNewSync", "receive a img msg");
				ChatMsgMgr.saveMsgThumbnail(cmdAM.MsgId, cmdAM.FromUserName.String, cmdAM.ToUserName.String, cmdAM.ImgBuf.Buffer.ToByteArray());
			}
			if (cmdAM.MsgType == 43)
			{
				Log.smethod_4("NetSceneNewSync", "receive a video msg, msgid = " + cmdAM.MsgId);
				ChatMsgMgr.saveVideoMsgThumbnail(cmdAM.MsgId, cmdAM.FromUserName.String, cmdAM.ToUserName.String, cmdAM.ImgBuf.Buffer.ToByteArray());
			}
			if (cmdAM.MsgType == 49 && cmdAM.ImgStatus == 2u)
			{
				Log.smethod_4("NetSceneNewSync", "receive a app msg");
				ChatMsgMgr.saveMsgThumbnail(cmdAM.MsgId, cmdAM.FromUserName.String, cmdAM.ToUserName.String, cmdAM.ImgBuf.Buffer.ToByteArray());
			}
		}
		private static void processDelMsgList(DelMsg cmdDM)
		{
		}
		private static void processModUserInfo(ModUserInfo cmdMUI)
		{
			if (cmdMUI == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModUserInfo,invalid object");
				return;
			}
			uint bitFlag = cmdMUI.BitFlag;
			Account curAccount = MicroMsg.Manager.AccountMgr.getCurAccount();
			string strUsrName = curAccount.strUsrName;
			Log.smethod_4("NetSceneNewSync", "mod user info, bitflag=" + bitFlag);
			if ((bitFlag & 1u) != 0u)
			{
				curAccount.strUsrName = cmdMUI.UserName.String;
			}
			if ((bitFlag & 2u) != 0u)
			{
				curAccount.strNickName = cmdMUI.NickName.String;
			}
			if ((bitFlag & 8u) != 0u)
			{
				curAccount.strBindEmail = cmdMUI.BindEmail.String;
			}
			if ((bitFlag & 16u) != 0u && !string.IsNullOrEmpty(cmdMUI.BindMobile.String))
			{
				curAccount.strBindMobile = cmdMUI.BindMobile.String;
			}
			if ((bitFlag & 64u) != 0u)
			{
				Log.smethod_5("NetSceneNewSync", string.Concat(new object[]
				{
					"processModUserImg ",
					strUsrName,
					" bitFlag:",
					bitFlag
				}));
				if (cmdMUI.ImgBuf.Length > 0)
				{
					HeadImageMgr.save(strUsrName, cmdMUI.ImgBuf.ToByteArray());
				}
			}
			if ((bitFlag & 32u) != 0u)
			{
				curAccount.nStatus = cmdMUI.Status;
			}
			if ((bitFlag & 128u) != 0u && cmdMUI.PersonalCard != 0u)
			{
				curAccount.nSex = cmdMUI.Sex;
				curAccount.strSignature = cmdMUI.Signature;
				curAccount.strProvince = cmdMUI.Province;
				curAccount.strCity = cmdMUI.City;
			}
			if ((bitFlag & 2048u) != 0u)
			{
				ExtentCenter.onPluginFlagChanged(cmdMUI.PluginFlag, curAccount.nPluginFlag);
				curAccount.nPluginFlag = cmdMUI.PluginFlag;
			}
			curAccount.nPluginSwitch = cmdMUI.PluginSwitch;
			curAccount.nVerifyFlag = (int)cmdMUI.VerifyFlag;
			curAccount.strVerifyInfo = cmdMUI.VerifyInfo;
			curAccount.strAlias = cmdMUI.Alias;
			curAccount.strCountry = cmdMUI.Country;
			curAccount.FaceBookFlag = cmdMUI.FaceBookFlag;
			curAccount.FBUserID = cmdMUI.FBUserID;
			curAccount.FBUserName = cmdMUI.FBUserName;
			curAccount.FBToken = cmdMUI.FBToken;
			curAccount.strWeibo = cmdMUI.Weibo;
			curAccount.strWeiboNickname = cmdMUI.WeiboNickname;
			curAccount.nWeiboFlag = cmdMUI.WeiboFlag;
			MicroMsg.Manager.AccountMgr.updateAccount();
		}
		private static void processModMsgStatus(ModMsgStatus cmdMMS)
		{
			if (cmdMMS == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModMsgStatus,invalid object");
				return;
			}
			ChatMsg chatMsg = new ChatMsg();
			chatMsg.nMsgSvrID = cmdMMS.MsgId;
			string strUsrName = MicroMsg.Manager.AccountMgr.getCurAccount().strUsrName;
			chatMsg.nStatus = (int)cmdMMS.Status;
			if (cmdMMS.FromUserName.String == strUsrName)
			{
				chatMsg.strTalker = cmdMMS.ToUserName.String;
			}
			else
			{
				if (cmdMMS.ToUserName.String == strUsrName)
				{
					chatMsg.strTalker = cmdMMS.FromUserName.String;
				}
				else
				{
					Log.smethod_1("NetSceneNewSync", "doCmd :ModMsgStatus not found this msg");
				}
			}
			StorageMgr.chatMsg.updateByMsgSvrID(chatMsg);
		}
		private static void processDelChatContact(DelChatContact cmdDCC)
		{
			if (cmdDCC == null)
			{
				Log.smethod_1("NetSceneNewSync", "processDelChatContact,invalid object");
				return;
			}
			StorageMgr.converation.method_5(cmdDCC.UserName.String);
		}
		private static void processDelContactMsg(DelContactMsg cmdDCM)
		{
			if (cmdDCM == null)
			{
				Log.smethod_1("NetSceneNewSync", "processDelContactMsg,invalid object");
			}
		}
		private static void processInviteFriendOpen(InviteFriendOpen cmdCI)
		{
			if (cmdCI == null)
			{
				Log.smethod_1("NetSceneNewSync", "processInviteFriendOpen,invalid object");
			}
		}
		private static void processModMicroBlog(ModMicroBlogInfo cmdMMB)
		{
			if (cmdMMB == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModMicroBlog,invalid object");
				return;
			}
			if (1u == cmdMMB.MicroBlogType)
			{
				return;
			}
			Log.smethod_1("NetSceneNewSync", "unknown micro blog type:" + cmdMMB.MicroBlogType);
		}
		private static void processFunctionSwitch(FunctionSwitch cmdFS)
		{
			if (cmdFS == null)
			{
				Log.smethod_1("NetSceneNewSync", "processFunctionSwitch,invalid object");
				return;
			}
			uint functionId = cmdFS.FunctionId;
			if (functionId == 1u)
			{
				Account curAccount = MicroMsg.Manager.AccountMgr.getCurAccount();
				curAccount.nPushMailStatus = (int)cmdFS.SwitchValue;
				if (!MicroMsg.Manager.AccountMgr.updateAccount())
				{
					Log.smethod_5("NetSceneNewSync", "update account failed");
					return;
				}
			}
			else
			{
				Log.smethod_5("NetSceneNewSync", "unknown function switch id:" + cmdFS.FunctionId);
			}
		}
		private static int processModChatRoomMemberList(List<object> cmdList)
		{
			List<Contact> list = new List<Contact>();
			try
			{
				using (List<object>.Enumerator enumerator = cmdList.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						object current = enumerator.get_Current();
						Contact contact = NetSceneNewSync.processModChatRoomMember(current as ModChatRoomMember);
						if (contact == null)
						{
							Log.smethod_1("NetSceneNewSync", "invalid cmd, convert cmd to ModChatRoomMember failed");
						}
						else
						{
							list.Add(contact);
						}
					}
				}
				StorageMgr.contact.mergeList(list);
			}
			catch (Exception ex)
			{
				Log.smethod_5("NetSceneNewSync", "processModChatRoomMember failed" + ex.get_Message());
			}
			Log.smethod_5("NetSceneNewSync", "StorageMgr.contact.updateList(contactList) finished");
			return cmdList.get_Count() - 1;
		}
		private static Contact processModChatRoomMember(ModChatRoomMember cmdCBM)
		{
			if (cmdCBM == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModChatRoomMember,invalid object");
				return null;
			}
			Contact contact = new Contact();
			contact.strUsrName = cmdCBM.UserName.String;
			contact.strNickName = cmdCBM.NickName.String;
			contact.strPYInitial = cmdCBM.PYInitial.String;
			contact.strQuanPin = cmdCBM.QuanPin.String;
			contact.nSex = cmdCBM.Sex;
			contact.strRemark = cmdCBM.Remark.String;
			contact.strRemarkPYInitial = cmdCBM.PYInitial.String;
			contact.strRemarkQuanPin = cmdCBM.RemarkQuanPin.String;
			contact.nContactType = cmdCBM.ContactType;
			if (cmdCBM.ImgFlag != 1u)
			{
				if (cmdCBM.ImgFlag == 2u)
				{
					contact.nImgFlag = cmdCBM.ImgFlag;
					HeadImageMgr.update(contact.strUsrName);
				}
				else
				{
					contact.nImgFlag = cmdCBM.ImgFlag;
				}
			}
			contact.nSnsFlag = cmdCBM.SnsUserInfo.SnsFlag;
			contact.strSnsBGImgID = cmdCBM.SnsUserInfo.SnsBGImgID;
			contact.nSnsBGObjectID = cmdCBM.SnsUserInfo.SnsBGObjectID;
			contact.strMyBrandList = cmdCBM.MyBrandList;
			contact.nBrandFlag = cmdCBM.CustomizedInfo.BrandFlag;
			contact.strBrandExternalInfo = cmdCBM.CustomizedInfo.ExternalInfo;
			contact.strBrandInfo = cmdCBM.CustomizedInfo.BrandInfo;
			contact.strBrandIconURL = cmdCBM.CustomizedInfo.BrandIconURL;
			return contact;
		}
		private static void processModTContact(TContact cmdMTC)
		{
			if (cmdMTC == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModTContact,invalid object");
				return;
			}
			if (ContactMgr.getUserType(cmdMTC.UserName) != ContactMgr.UserType.UserTypeTencent)
			{
				Log.smethod_5("NetSceneNewSync", "processModQContact: is invalid QQ contact ");
			}
		}
		private static void processModQContact(QContact cmdMQC)
		{
			if (cmdMQC == null)
			{
				Log.smethod_1("NetSceneNewSync", "processModQContact,invalid object");
				return;
			}
			if (ContactMgr.getUserType(cmdMQC.UserName) != ContactMgr.UserType.UserTypeQQ)
			{
				Log.smethod_5("NetSceneNewSync", "processModQContact: is invalid QQ contact ");
				return;
			}
			Contact contact = StorageMgr.contact.method_0(cmdMQC.UserName);
			if (contact == null)
			{
				Log.smethod_5("NetSceneNewSync", "processModQContact: new QQ contact ");
				contact = new Contact();
				contact.strUsrName = cmdMQC.UserName;
				contact.strNickName = cmdMQC.DisplayName;
				contact.nContactType = 4u;
				ContactMgr.setChatContact(contact, true);
				contact.nExtInfoSeq = 0;
				contact.nImgUpdateSeq = 0;
			}
			else
			{
				contact.strNickName = cmdMQC.DisplayName;
				if (contact.nExtInfoSeq == (int)cmdMQC.ExtInfoSeq)
				{
					if (contact.nImgUpdateSeq == (int)cmdMQC.ImgUpdateSeq)
					{
						Log.smethod_5("NetSceneNewSync", "processModQContact: old QQ contact no need update");
						goto IL_E8;
					}
				}
				Log.smethod_5("NetSceneNewSync", "processModQContact: old QQ contact,need update ");
				contact.nExtInfoSeq = 0;
				contact.nImgUpdateSeq = 0;
			}
			IL_E8:
			StorageMgr.contact.update(contact);
		}
		public static void processModBottleContact(ModBottleContact bottleContact)
		{
			if (bottleContact != null && !string.IsNullOrEmpty(bottleContact.UserName))
			{
				Log.smethod_5("NetSceneNewSync", string.Concat(new object[]
				{
					"bottleContact.UserName = ",
					bottleContact.UserName,
					" imgflag:",
					bottleContact.ImgFlag,
					" hd:",
					bottleContact.HDImgFlag
				}));
				BottleContact bottleContact2 = new BottleContact();
				bottleContact2.strUserName = bottleContact.UserName;
				bottleContact2.nType = (int)bottleContact.Type;
				bottleContact2.nSex = (int)bottleContact.Sex;
				bottleContact2.strCity = bottleContact.City;
				bottleContact2.strProvince = bottleContact.Province;
				bottleContact2.strSignature = bottleContact.Signature;
				bottleContact2.nImgFlag = (int)bottleContact.ImgFlag;
				bottleContact2.nCreateTime = (long)Util.getNowMilliseconds();
				if (bottleContact2.nImgFlag == 0)
				{
					bottleContact2.nImgFlag = 4;
				}
				if (bottleContact2.nImgFlag == 2)
				{
					HeadImageMgr.update(bottleContact2.strUserName);
				}
				bottleContact2.nHDImgFlag = ((bottleContact2.nImgFlag == 4) ? 0 : 1);
				StorageMgr.bContact.update(bottleContact2);
				return;
			}
			Log.smethod_1("NetSceneNewSync", "processModBottleContact,invalid object");
		}
		private static void processModUserImg(ModUserImg cmdUI)
		{
			Log.smethod_5("NetSceneNewSync", string.Concat(new object[]
			{
				"processModUserImg  type:",
				cmdUI.ImgType,
				" md5:",
				cmdUI.ImgMd5
			}));
			string text;
			if (cmdUI.ImgType == 2u)
			{
				text = MicroMsg.Manager.AccountMgr.getCurAccount().strUsrName + ConstantValue.TAG_BOTTLE;
				if (string.IsNullOrEmpty(MicroMsg.Manager.AccountMgr.getCurAccount().strBottleHDheadImgVersion) || MicroMsg.Manager.AccountMgr.getCurAccount().strBottleHDheadImgVersion != cmdUI.ImgMd5)
				{
					HDheadImgMgr.delHeadimg(text);
					MicroMsg.Manager.AccountMgr.getCurAccount().strBottleHDheadImgVersion = cmdUI.ImgMd5;
				}
			}
			else
			{
				text = MicroMsg.Manager.AccountMgr.getCurAccount().strUsrName;
				if (string.IsNullOrEmpty(MicroMsg.Manager.AccountMgr.getCurAccount().strHDheadImgVersion) || MicroMsg.Manager.AccountMgr.getCurAccount().strHDheadImgVersion != cmdUI.ImgMd5)
				{
					HDheadImgMgr.delHeadimg(text);
					MicroMsg.Manager.AccountMgr.getCurAccount().strHDheadImgVersion = cmdUI.ImgMd5;
				}
			}
			HeadImageMgr.save(text, cmdUI.ImgBuf.ToByteArray());
			MicroMsg.Manager.AccountMgr.updateAccount();
		}
		public int getRecvMsgStatus()
		{
			return this.mRecvMsgStatus;
		}
		public void setRecvMsgStatus(RecvMsgStatus status)
		{
			this.mRecvMsgStatus |= (int)status;
		}
		public void unsetRecvMsgStatus(RecvMsgStatus status)
		{
			this.mRecvMsgStatus &= (int)(~(int)status);
		}
		private static void processModUserInfoExt(UserInfoExt cmdExtInfo)
		{
			Account curAccount = MicroMsg.Manager.AccountMgr.getCurAccount();
			curAccount.nSnsFlag = cmdExtInfo.SnsUserInfo.SnsFlag;
			curAccount.strSnsBGImgID = cmdExtInfo.SnsUserInfo.SnsBGImgID;
			curAccount.nSnsBGObjectID = cmdExtInfo.SnsUserInfo.SnsBGObjectID;
			curAccount.MyBrandList = cmdExtInfo.MyBrandList;
			curAccount.MsgPushSound = cmdExtInfo.MsgPushSound;
			curAccount.VoipPushSound = cmdExtInfo.VoipPushSound;
			MicroMsg.Manager.AccountMgr.updateAccount();
		}
	}
}
